package com.ccys.cms.controller.masterData;

import com.ccys.cms.service.masterData.CountryService;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.masterData.*;
import com.ccys.db.vo.masterData.CountryListVo;
import com.ccys.db.vo.masterData.CountryPageQueryVo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: WhiteCoat
 * @description: 国家接口
 * @author: ZhangJingCan
 * @create: 2023-12-13 11:25
 **/

@RestController
@RequestMapping("masterData")
@Api(tags = "masterData-国家接口")
public class CountryController {

    @Autowired
    private CountryService countryService;


    
    @PostMapping("country")
    @ApiOperation("保存国家")
    public ResponseResult saveCountry(CountrySaveDto dto) {
        return countryService.saveCountry(dto);
    }

    @PutMapping("country")
    @ApiOperation("修改国家")
    public ResponseResult editCountry(CountrySaveDto dto) {
        return countryService.saveCountry(dto);
    }

    
    @DeleteMapping("country")
    @ApiOperation("根据ID删除国家")
    public ResponseResult deleteCountry(CountryIdDto dto) {
        return countryService.deleteCountry(dto);
    }

    
    @GetMapping("country")
    @ApiOperation("分页查询国家")
    public ResponseResult<PageInfo<CountryPageQueryVo>, Object> findPageCountry(CountryPageQueryDto dto) {
        return countryService.findPageCountry(dto);
    }

    @GetMapping("country/list")
    @ApiOperation("国家下拉列表list")
    public ResponseResult<List<CountryListVo>, Object> findList() {
        return countryService.findList();
    }

    
    @GetMapping("findListServiceTypeAndProfileTypeByCountryId")
    @ApiOperation("根据国家ID查询ServiceType以及ProfileType")
    public ResponseResult findListServiceTypeAndProfileTypeByCountryId(CountryIdDto dto) {
        return countryService.findListServiceTypeAndProfileTypeByCountryId(dto);
    }

    
    @PutMapping("country/countryServiceType")
    @ApiOperation("修改国家服务设置")
    public ResponseResult updateServiceType(CountryServiceTypeDto dto) {
        return countryService.updateServiceType(dto);
    }

    
    @PutMapping("country/countryServiceTypeProfileType")
    @ApiOperation("修改国家服务设置详细")
    public ResponseResult updateCountryServiceTypeProfileType(CountryServiceTypeProfileTypeDto dto) {
        return countryService.updateCountryServiceTypeProfileType(dto);
    }

    @PutMapping("country/countrySetDoc")
    @ApiOperation("修改国家Doc设置")
    public ResponseResult countrySetDoc(CountrySetDocDto dto) {
        return countryService.countrySetDoc(dto);
    }

}
